#include <iostream>

#include <windows.h>
#include <stdio.h>
#include <malloc.h>

#include "win32-dlfcn.h"

using namespace std;


//typedef int (*JNI_CreateJavaVMT)(JavaVM **pvm, void **penv, void *args);  

typedef int (*PMessageBox)(
  _In_opt_ HWND    hWnd,
  _In_opt_ LPCTSTR lpText,
  _In_opt_ LPCTSTR lpCaption,
  _In_     UINT    uType
);


//test win32-dlfcn
int main()
{
	void* hanle=dlopen("User32.dll",RTLD_NOW);
	PMessageBox pMessageBox=(PMessageBox)dlsym(hanle,"MessageBoxA");
	
	int msgboxID = pMessageBox(
        NULL,
        (LPCTSTR)"Resource not available\nDo you want to try again?",
        (LPCTSTR)"Account Details",
        MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2
    );

	
	cout<<"ok "<<"msgboxID="<<msgboxID<<endl;
	return 0;
}